package com.doitedu.day01

/**
 * @Date 22.6.19
 * @Created by HANGGE
 * @Description
 *             1   for (elem <- array)
 *              2 for (i <- 0 until array.length)
 */
object _03ForDemo01 {
  def main(args: Array[String]): Unit = {
    val array  = Array[Int](1,3,5,7,9,2,4,6,8)

    for (i <- 0 until array.length){
      println(array(i))
    }


    //  [0 1 2 3 4 5 6 7 8 9]连续的数字
/*    val range1 = 0 to 9
    val range2 = 0 until 9*/

  /*  for (i <- 0 to array.length-1){
      println(i)
    }

    for (i <- 0 until array.length){
      println(i)
    }*/
   // for (index <- 0 to 9){
  /*  for (index <- range1){
      println(index)
    }*/

   //将数组中的每个元素依次赋值给 elem  循环
  /*  for (elem <- array) { // 类似于增强for循环
      println(elem)
    }
*/






  }

}
